home *** CD-ROM | disk | FTP | other *** search
-
- This doc briefly describes four small libraries for PMODE. These libraries
- are as follows:
-
- KB - A low level keyboard interface.
- FILE - A modest file library.
- ARGC - Handles command line arguments and switches
- VGA50 - Some routines for VGA 80x50 and 90x50 text modes.
-
- I wrote them all for myself, just like PMODE, but I think they may be useful
- to you. All the library functions expect the following (I hope you read the
- PMODE dox first), CS=_selcode, DS=ES=_seldata, GS=_selzero, and the direction
- flag clear. The descriptions provided here are not too full. Check out the
- example files to see just how they work.
-
- ------------------------------------------------------------------------------
- KB:
- ---
-
- This is a low level keyboard interface. This means that it uses the keyboard
- hardware directly, and does not go through the INT 16h keyboard functions. In
- fact, it takes the keyboard IRQ 1 for itself, disabling BIOS keyboard
- processing. KB can keep track of which keys are depressed, and when they are
- released. KB installs a protected mode keyboard IRQ handler and a real mode
- callback to for it.
-
- Functions:
- ----------
-
- _initkb - Initialize keyboard handler
- Out:
- BX,EDX,EDI - ?
- Notes:
- This initializes the keyboard handles. You must call this before you can
- use the keyboard handler.
-
- _resetkb - Reset keyboard handler
- Out:
- BX,EDX - ?
- Notes:
- Restores the keyboard to BIOS control. You must call this before exiting
- to DOS.
-
- _getch - Get the last character pressed
- Out:
- AL - case adjusted character
- AH - shift state bits: 0=SHIFT, 1=ALT, 2=CTRL
- Notes:
- Gets the last character pressed or waits for one if none. The interrupt
- flag must be enabled. Check out KB.INC for more information about
- special character values.
-
- _clearkb - Clear all kb stuff
- Out:
- EAX,ECX,EDI - ?
- Notes:
- Clears the last key hit and the low level sticky and non-sticky buffers.
-
- Data:
- -----
-
- _kbchar - Last key that was hit.
- _kbshift - Shift states for lask key, bits: 0=SHIFT, 1=ALT, 2=CTRL.
- _kbhit - Keyboard status: 0=no key hit, 1=key hit available.
- _kbtbl0 - Non-sticky keyboard table. This is an 80h byte table for the status
- of any key on the keyboard. Whenever a key is pressed, the byte in this
- table at the offset of the keys scan code will be set to a non-zero value.
- When that key is released, the byte will be set back to zero.
- _kbtbl1 - Sticky keyboard table. The same as the non-sticky table, except that
- when a key is released, its byte will not be set to zero in this table.
-
- ------------------------------------------------------------------------------
- FILE:
- -----
-
- This is just a bunch of file routines. It simplifies reading and writing by
- allowing you to read or write the full length of a file, not just < 64k. Also,
- you can read or write to high memory. FILE will do any necessary buffering.
- You should assume these functions destroy v86r_ax, v86r_cx, v86r_dx, and
- v86r_ds. Also, v86r_bx may be set to a file handle if opening or creating
- files. You must allocate a buffer in low memory of length _filebuflen and
- store its address in _filebufloc if you are going to be reading or writing to
- high memory, or if you are going to be using the _filecopy function at all.
- The way _readfile and _writefile check to see if you are writing to high
- memory is they check the sum of EDX and ECX to see if that address falls above
- 1M. Which means if you try to read in a whole file by reading with
- ECX - 0ffffffffh, you must have the low memory buffer allocated for FILE.
-
- Functions:
- ----------
-
- _createfile - Create file
- In:
- EDX -> ASCIIZ filename
- Out:
- CF=1 - Error creating file
- CF=0 - File created succesfully
- V86R_BX - file handle
-
- _openfile - Open file
- In:
- EDX -> ASCIIZ filename
- Out:
- CF=1 - Error opening file
- CF=0 - File opened succesfully
- V86R_BX - file handle
-
- _closefile - Close a file
- In:
- V86R_BX - file handle
- CF=1 - Error closing file
- CF=0 - File closed succesfully
-
- _deletefile - Delete a file
- In:
- EDX -> ASCIIZ filename
- Out:
- CF=1 - Error deleting file
- CF=0 - File deleted succesfully
-
- _lseekfile - Seek position in file
- In:
- V86R_BX - file handle
- EAX - signed offset to move to
- BL - from: 0-beginning of file, 1-current location, 2-end of file
- Out:
- CF=1 - Error seeking in file
- EAX - ?
- CF=0 - Seek fine
- EAX - new offset from beginning of file
-
- _filesize - Get size of file
- In:
- V86R_BX - file handle
- Out:
- CF=1 - Error checking file
- EAX - ?
- CF=0 - check fine
- EAX - size of file
-
- _readfile - Read from file
- In:
- V86R_BX - file handle
- EDX -> buffer to read to
- ECX - number of bytes to read
- Out:
- CF=1 - Error reading file
- EAX - ?
- CF=0 - Read went fine
- EAX - number of bytes read
- Notes:
- Remember, if EDX+ECX > 1M, FILE will attempt to use its buffer that you
- hopefully allocated and stored in _filebufloc.
-
- _writefile - Write to file
- In:
- V86R_BX - file handle
- EDX -> buffer to write from
- ECX - number of bytes to write
- Out:
- CF=1 - Error writing file
- EAX - ?
- CF=0 - Write went fine
- EAX - number of bytes written
- Notes:
- Remember, if EDX+ECX > 1M, FILE will attempt to use its buffer that you
- hopefully allocated and stored in _filebufloc.
-
- _filecopy - Copy some bytes from one file to another
- In:
- V86R_SI - source file handle
- V86R_DI - destination file handle
- ECX - number of bytes to copy
- Out:
- CF=1 - Error copying file
- EAX - ?
- CF=0 - copied fine
- EAX - number of bytes copied
- Notes:
- You must have the FILE buffer allocated if you are going to be using this
- function at all.
-
- _findfile - Do an AH=4E file find
- In:
- AL - type of search: 4E-first, 4F-next
- CX - search attributes
- EDX -> 13 byte buffer for filename found
- EDI -> search mask
- Out:
- CF=1 - file not found
- EDX -> ?
- CF=0 - file found
- EDX -> filename
-
- Data:
- -----
-
- _filebufloc:dword - The pointer to the FILE buffer for use in high memory
- reads and writes and in _filecopy.
- _filebuflen:word - The length of the FILE buffer. Can be changed at any time,
- as long as there is the memory for it.
-
- ------------------------------------------------------------------------------
- ARGC:
- -----
-
- This is some code to get command line switches and strings. A switch is any
- character preceded by a - or a /. A string is anything else. A string
- directly following a switch (no space) is not considered a string.
-
- Functions:
- ----------
-
- _cchekswitchnc - Chek if switch AL entered on command line
- In:
- AL - switch (if it is a letter, both upper and lower case are checked)
- Out:
- CF=1 - switch does not exist
- CF=0 - switch exists on command line
-
- _cchekswitch - Chek if switch AL entered on command line
- In:
- AL - switch (case sensitive
- Out:
- CF=1 - switch does not exist
- CF=0 - switch exists on command line
-
- _cchekstr - Get string number AL
- In:
- AL - string number (0 is first, 1 is second, etc...)
- EDX -> buffer for string
- Out:
- CF=1 - string not found
- CF=0 - string found
- EDX - ASCIIZ string
-
- _ccheksstr - Get string directly following switch AL
- In:
- AL - switch
- EDX -> buffer for string
- Out:
- CF=1 - string not found
- CF=0 - string found or switch does not have string
- EDX -> ASCIIZ string (if present, otherwise unmodified)
-
- ------------------------------------------------------------------------------
- VGA50:
- ------
-
- This is just a bunch of VGA text mode routines. Basically just sets up VGA
- 80x50 or 90x50 text mode, shuts off blinking and enables the BG high color
- bit. Also maps the 16 text mode color indexes to the first 16 DAC registers.
-
- Functions:
- ----------
-
- _initvga50 - Init VGA 50 line text mode and set color numbers
-
- _putstr - Put ASCIIZ string to screen
- In:
- AH - attribute
- BL - X
- BH - Y
- EDX -> ASCIIZ string
-
- _pushtext - Save an area of the screen to video stack
- In:
- BL - X
- BH - Y
- CL - delta X
- CH - delta Y
- Notes:
- Uses video memory beyond the displayed first page for the stack. You are
- responsible for not overflowing it.
-
- _poptext - Restore last pushed area of the screen from video stack
-
- _textbox0 - Put box filled with character to screen
- In:
- AL - character to fill with
- AH - attribute
- BL - X
- BH - Y
- CL - delta X
- CH - delta Y
-
- _textbox1 - Put outlined box to screen
- In:
- AH - attribute
- BL - X
- BH - Y
- CL - delta X
- CH - delta Y
- EDX -> outlining characters in the following order 'ƒ≥⁄ø¿Ÿf'
-
- _setchars - Set a group of character bitmaps
- In:
- AL - first ASCII character to set
- BL - number of bytes (lines) per character
- CL - number of characters to set minus 1
- EDX -> bitmap data for characters
- Notes:
- Remember that in 80 column mode, character column 9 will be the same as
- column 8 only for characters 0c0h-0dfh, in all other characters column 9
- will be empty.
-
-